import Clipboard from 'clipboard';
import { toast } from '../../common/js/toast';
export function copy(params){
  /*复制功能*/
  if( params && params instanceof Object && params instanceof Array === false && params.id ){
    let id = params.id;
    let toastInfo = params.toast || '复制成功';
    let clipboard = new Clipboard(id);
    clipboard.on('success', function( e ) {
      toast(toastInfo);
      clipboard.destroy();
    });
    clipboard.on('error', function( e ) {
      toast('提示：手机暂不支持复制！');
      clipboard.destroy()
    })
  }
}
